


<!DOCTYPE html>
<html id="htmlId">
<head>
  <title>Coverage Report > OrderController</title>
  <style type="text/css">
    @import "../../css/coverage.css";
    @import "../../css/highlight-idea.css";
  </style>
  <script type="text/javascript" src="../../js/highlight.pack.js"></script>
</head>

<body>
<div class="content">
<div class="breadCrumbs">
Current scope:     <a href="../../index.html">all classes</a>
    <span class="separator">|</span>
    <a href="../index.html">com.example.bookstorebackend.controller</a>
</div>

<h1>Coverage Summary for Class: OrderController (com.example.bookstorebackend.controller)</h1>

<table class="coverageStats">
<tr>
  <th class="name">Class</th>
<th class="coverageStat 
">
  Class, %
</th>
<th class="coverageStat 
">
  Method, %
</th>
<th class="coverageStat 
">
  Line, %
</th>
</tr>
<tr>
  <td class="name">OrderController</td>
<td class="coverageStat">
  <span class="percent">
    100%
  </span>
  <span class="absValue">
    (1/1)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    100%
  </span>
  <span class="absValue">
    (4/4)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    100%
  </span>
  <span class="absValue">
    (30/30)
  </span>
</td>
</tr>

</table>

<br/>
<br/>


<pre>
<div class="sourceCode" id="sourceCode"><i class="no-highlight">1</i>&nbsp;package com.example.bookstorebackend.controller;
<i class="no-highlight">2</i>&nbsp;
<i class="no-highlight">3</i>&nbsp;
<i class="no-highlight">4</i>&nbsp;import com.example.bookstorebackend.entity.Order;
<i class="no-highlight">5</i>&nbsp;import com.example.bookstorebackend.service.OrderService;
<i class="no-highlight">6</i>&nbsp;import net.sf.json.JSONObject;
<i class="no-highlight">7</i>&nbsp;import org.springframework.beans.factory.annotation.Autowired;
<i class="no-highlight">8</i>&nbsp;import org.springframework.web.bind.annotation.CrossOrigin;
<i class="no-highlight">9</i>&nbsp;import org.springframework.web.bind.annotation.RequestBody;
<i class="no-highlight">10</i>&nbsp;import org.springframework.web.bind.annotation.RequestMapping;
<i class="no-highlight">11</i>&nbsp;import org.springframework.web.bind.annotation.RestController;
<i class="no-highlight">12</i>&nbsp;
<i class="no-highlight">13</i>&nbsp;import java.text.ParseException;
<i class="no-highlight">14</i>&nbsp;import java.text.SimpleDateFormat;
<i class="no-highlight">15</i>&nbsp;import java.util.ArrayList;
<i class="no-highlight">16</i>&nbsp;import java.util.Date;
<i class="no-highlight">17</i>&nbsp;import java.util.List;
<i class="no-highlight">18</i>&nbsp;
<i class="no-highlight">19</i>&nbsp;
<i class="no-highlight">20</i>&nbsp;@RestController
<i class="no-highlight">21</i>&nbsp;@CrossOrigin(origins = &quot;*&quot;, maxAge = 3600)
<b class="fc"><i class="no-highlight">22</i>&nbsp;public class OrderController {</b>
<i class="no-highlight">23</i>&nbsp;    @Autowired
<i class="no-highlight">24</i>&nbsp;    private OrderService orderService;
<i class="no-highlight">25</i>&nbsp;
<i class="no-highlight">26</i>&nbsp;    @RequestMapping(&quot;/getOrders&quot;)
<i class="no-highlight">27</i>&nbsp;    public JSONObject getOrders(@RequestBody JSONObject params){
<b class="fc"><i class="no-highlight">28</i>&nbsp;        Integer userId= Integer.valueOf(params.getString(&quot;userId&quot;));</b>
<b class="fc"><i class="no-highlight">29</i>&nbsp;        return orderService.userGetAll(userId);</b>
<i class="no-highlight">30</i>&nbsp;    }
<i class="no-highlight">31</i>&nbsp;    @RequestMapping(&quot;/getOrdersByTime&quot;)
<i class="no-highlight">32</i>&nbsp;    public JSONObject getOrdersByTime(@RequestBody JSONObject params){
<b class="fc"><i class="no-highlight">33</i>&nbsp;        Integer userId= Integer.valueOf(params.getString(&quot;userId&quot;));</b>
<b class="fc"><i class="no-highlight">34</i>&nbsp;        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(&quot;yyyy-MM-dd HH:mm:ss&quot;);</b>
<b class="fc"><i class="no-highlight">35</i>&nbsp;        Date start=new Date();</b>
<b class="fc"><i class="no-highlight">36</i>&nbsp;        Date end=new Date();</b>
<i class="no-highlight">37</i>&nbsp;        try {
<b class="fc"><i class="no-highlight">38</i>&nbsp;            start=simpleDateFormat.parse(params.getString(&quot;start&quot;));</b>
<b class="fc"><i class="no-highlight">39</i>&nbsp;        } catch (ParseException e) {</b>
<b class="fc"><i class="no-highlight">40</i>&nbsp;            e.printStackTrace();</b>
<b class="fc"><i class="no-highlight">41</i>&nbsp;        }</b>
<i class="no-highlight">42</i>&nbsp;        try {
<b class="fc"><i class="no-highlight">43</i>&nbsp;            end=simpleDateFormat.parse(params.getString(&quot;end&quot;));</b>
<b class="fc"><i class="no-highlight">44</i>&nbsp;        } catch (ParseException e) {</b>
<b class="fc"><i class="no-highlight">45</i>&nbsp;            e.printStackTrace();</b>
<b class="fc"><i class="no-highlight">46</i>&nbsp;        }</b>
<b class="fc"><i class="no-highlight">47</i>&nbsp;        return orderService.userGetAll(userId,start,end);</b>
<i class="no-highlight">48</i>&nbsp;    }
<i class="no-highlight">49</i>&nbsp;    @RequestMapping(&quot;/comByTime&quot;)
<i class="no-highlight">50</i>&nbsp;    public JSONObject comByTime(@RequestBody JSONObject params){
<b class="fc"><i class="no-highlight">51</i>&nbsp;        Integer userId= Integer.valueOf(params.getString(&quot;userId&quot;));</b>
<b class="fc"><i class="no-highlight">52</i>&nbsp;        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(&quot;yyyy-MM-dd HH:mm:ss&quot;);</b>
<b class="fc"><i class="no-highlight">53</i>&nbsp;        Date start=new Date();</b>
<b class="fc"><i class="no-highlight">54</i>&nbsp;        Date end=new Date();</b>
<i class="no-highlight">55</i>&nbsp;        try {
<b class="fc"><i class="no-highlight">56</i>&nbsp;            start=simpleDateFormat.parse(params.getString(&quot;start&quot;));</b>
<b class="fc"><i class="no-highlight">57</i>&nbsp;        } catch (ParseException e) {</b>
<b class="fc"><i class="no-highlight">58</i>&nbsp;            e.printStackTrace();</b>
<b class="fc"><i class="no-highlight">59</i>&nbsp;        }</b>
<i class="no-highlight">60</i>&nbsp;        try {
<b class="fc"><i class="no-highlight">61</i>&nbsp;            end=simpleDateFormat.parse(params.getString(&quot;end&quot;));</b>
<b class="fc"><i class="no-highlight">62</i>&nbsp;        } catch (ParseException e) {</b>
<b class="fc"><i class="no-highlight">63</i>&nbsp;            e.printStackTrace();</b>
<b class="fc"><i class="no-highlight">64</i>&nbsp;        }</b>
<i class="no-highlight">65</i>&nbsp;
<b class="fc"><i class="no-highlight">66</i>&nbsp;        System.out.println(start);</b>
<b class="fc"><i class="no-highlight">67</i>&nbsp;        return orderService.comAll(userId,start,end);</b>
<i class="no-highlight">68</i>&nbsp;    }
<i class="no-highlight">69</i>&nbsp;
<i class="no-highlight">70</i>&nbsp;
<i class="no-highlight">71</i>&nbsp;}
</div>
</pre>
</div>

<script type="text/javascript">
(function() {
    var msie = false, msie9 = false;
    /*@cc_on
      msie = true;
      @if (@_jscript_version >= 9)
        msie9 = true;
      @end
    @*/

    if (!msie || msie && msie9) {
        var codeBlock = document.getElementById('sourceCode');

        if (codeBlock) {
            hljs.highlightBlock(codeBlock);
        }
    }
})();
</script>

<div class="footer">
    
    <div style="float:right;">generated on 2022-04-14 17:03</div>
</div>
</body>
</html>
